import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** IPMAC信息 */
export interface Ipv4Mac {
          id: number; // ID
          portId?: number; // 端口ID
          deviceId: number; // 设备ID
          macAddress?: string; // mac地址
          ipv4Address?: string; // ipv4地址
          contextName?: string; // SNMP 上下文名称
  }

// IPMAC API
export const Ipv4MacApi = {
  // 查询IPMAC分页
  getIpv4MacPage: async (params: any) => {
    return await request.get({ url: `/business/ipv4-mac/page`, params })
  },

    // 根据设备ID查询IPMAC列表
    getIpv4MacList: async (params: any) => {
      return await request.get({ url: `/business/ipv4-mac/list`, params })
    },

  // 查询IPMAC详情
  getIpv4Mac: async (id: number) => {
    return await request.get({ url: `/business/ipv4-mac/get?id=` + id })
  },

  // 新增IPMAC
  createIpv4Mac: async (data: Ipv4Mac) => {
    return await request.post({ url: `/business/ipv4-mac/create`, data })
  },

  // 修改IPMAC
  updateIpv4Mac: async (data: Ipv4Mac) => {
    return await request.put({ url: `/business/ipv4-mac/update`, data })
  },

  // 删除IPMAC
  deleteIpv4Mac: async (id: number) => {
    return await request.delete({ url: `/business/ipv4-mac/delete?id=` + id })
  },

  /** 批量删除IPMAC */
  deleteIpv4MacList: async (ids: number[]) => {
    return await request.delete({ url: `/business/ipv4-mac/delete-list?ids=${ids.join(',')}` })
  },

  // 导出IPMAC Excel
  exportIpv4Mac: async (params) => {
    return await request.download({ url: `/business/ipv4-mac/export-excel`, params })
  },
}
